473,425 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

FTPWebRequest failing - URGENT

I am using .NET 2.0 new classed for FTP download purpose. I have
requirement to connect with 3 different FTP and download all files
list and see if file exist at my end. if not then i need to download.
I am keeping my configuration in XML file so that i can use my same
code and i simply iterate on my configuration data. 1st FTP connect
works fine but 2nd FTP does not connect and return with following
error message. After this failure when my code attemp to for the 3rd
FTP, it works. but it also fail on Download file for 3rd FTP on some
files. I could not find any specific reason for this exception. If i
make my failing FTP as 1st one, so in general my second FTP request in
my loop fails. i tested 3 ftp in internet explorer and they work fine.
but in .NET 2.0 new classes i can see these un knonw behaviours. any
suggestion on improving code or setting some other property which i am
missing?????????????
The remote server returned an error: (503) Bad sequence of commands.
I further trace the error line, it is coming on following line,
response = reqFTP.GetResponse()

here is my code below which works well for 1st FTP Request but it
fails on 2nd FTP.
reqFTP = System.Net.FtpWebRequest.Create(New Uri("ftp://"
+ Me.FTP_Address))
reqFTP.KeepAlive = True
reqFTP.UseBinary = True
reqFTP.Credentials = New
System.Net.NetworkCredential(Me.FTP_User, Me.FTP_Password)
reqFTP.Method =
System.Net.WebRequestMethods.Ftp.ListDirectory
response = reqFTP.GetResponse()
reader = New
System.IO.StreamReader(response.GetResponseStream( ))
line = reader.ReadLine()
While (Not line Is Nothing)
result.Append(line)
result.Append(",")
line = reader.ReadLine()
End While
' to remove the trailing ','
result.Remove(result.ToString().LastIndexOf(","), 1)
reader.Close()
It is URGENT for me to resolve this issue, otherwise i will have to
switch to a 3rd Party FTP component. I was excited about 2.0 new
classes and i hope this issue will resolve with some one's feedback.

Jun 15 '07 #1
1 9271
I figured it out now. 1st of all i was not setting up KeepAlive
property at all. Then i thought i should setup it as TRUE as default
may be FALSE. but it did not work out. Then i setup it to FALSE
explicitly and now every thing is working fine.

Jun 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
7
by: jose.lopes.cruz | last post by:
I need to access a FTP Server. I'm using FTPWebRequest as described in visual studio 2005 documentation. Everything works fine except the following: 1) I dont know how to change de current...
6
by: ajit | last post by:
I am working on web service which in turn call com components. if # of users using the web service increases. Web service fails is there some why I can prevent max # of concurrent users using the...
0
by: Alexis | last post by:
Hello, I am trying to upload a file to an ftp server using the FtpWebRequest class, but I get the following error. The requested URI is invalid for this FTP command. I do can upload the file...
3
by: Kevien Lee | last post by:
hi everyone I have a quick question when i use the FtpWebRequest. What I need to do is that: Connect a FTP server,check whether there is a folder if not,create it, then changed the path to...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
6
by: William LaMartin | last post by:
Could someone show me how to use the FtpWebRequest and change to a different directory? Changing directories is not listed as one of the methods, but I believe it can be done--just can't figure...
9
by: Waldy | last post by:
Hi there, I have written a service in VS2005 that downloads files from an FTP site processes them and then deletes the files if successfully processed. It all works fine when run in our test lab...
6
by: Patrick.Simons | last post by:
I try to connect a FTPWebRequest through Proxy and VPN to a remote FTP- server. Sometimes it works sometimes not. When my VB.Net-App (2005) returns the error on the GetResponse-Method, I'll try to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.